package com.bank.svc;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.bank.dao.BankCardDao;
import com.bank.dao.BankUserDao;
import com.bank.pojo.BankCards;
import com.bank.pojo.BankUserinfo;

@Service("bankCardSvc")
public class BankCardSvc {
	@Resource(name="bankCardDao")
	private BankCardDao bcd;
	@Resource(name="bankUserDao")
	private BankUserDao bud;
	
	public boolean addCard(BankCards card){
		return bcd.addCard(card);
	}
	public boolean addNewCard(BankCards card,String docNum){
		if(bud.checkUserAccount(docNum)){
			BankUserinfo user=bud.getUserByDoc(docNum);
			card.setBankUserinfo(user);
			return bcd.addCard(card);
		}
		return false;
	}

	public void setBcd(BankCardDao bcd) {
		this.bcd = bcd;
	}
	public void setBud(BankUserDao bud) {
		this.bud = bud;
	}
}
